﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Reflection;
using System.Collections.Generic;
using Confucius.entity;

namespace Confucius.utils
{
    public class ConfuciusUtil
    {
        public static Uri buildImageUri(String gameID, String imageID)
        {
            String project = Assembly.GetExecutingAssembly().FullName.Split(',')[0].ToString();
            Uri uri = new Uri("/" + project + ";component/assets/gameFiles/"
                            + gameID + "/" + imageID + ".png", UriKind.Relative);

            return uri;

        }

        public static Uri buildImageUriWithExtension(String gameID, String imageID)
        {
            String project = Assembly.GetExecutingAssembly().FullName.Split(',')[0].ToString();
            Uri uri = new Uri("/" + project + ";component/assets/gameFiles/"
                            + gameID + "/" + imageID, UriKind.Relative);

            return uri;

        }

        public static Uri buildMediaUri(String gameID, String mediaName)
        {
            String project = Assembly.GetExecutingAssembly().FullName.Split(',')[0].ToString();
            Uri uri = new Uri("assets/gameFiles/" + gameID + "/" + mediaName, UriKind.Relative);

            return uri;

        }

        public static Uri buildVideoBackgroundUri(string background)
        {
            String project = Assembly.GetExecutingAssembly().FullName.Split(',')[0].ToString();
            Uri uri = new Uri("/" + project + ";component/assets/ui/" + background, UriKind.Relative);

            return uri;

        }

        public static int finishedQuestsCount(List<Quest> questList)
        {
            int count = 0;

            foreach (Quest quest in questList)
            {
                if (quest.Status.Equals(Quest.COMPLETE_STATUS))
                {
                    count++;
                }
            }

            return count;
        }
    }
}
